<%@ include file="../../base/include.jsp"%>

<div class="page-header">
	<h2>System Properties</h2>
</div>

<table class="table table-striped table-condensed table-properties">
	<thead>
		<tr>
			<th>Property</th>
			<th>Min.Value</th>
			<th>Max.Value</th>
			<th>Default&nbsp;Value</th>
			<th>Description</th>
			<th>&nbsp;</th>
		</tr>
	</thead>
	<tbody>
	<c:forEach var="property" items="${propertyList.properties}">
		<tr id="${property.name}">
			<%@include file="property.jsp"%>
		</tr>
	</c:forEach>
	</tbody>
</table>

<script type="text/javascript">
	$('#menuProperties').addClass('active');

	function handleKeyPress(e, propertyName) {
		var key = e.keyCode || e.which;
		if (key == 13) {
			changeValue(propertyName);
		}
	}

	function changeValue(propertyName) {
		var newValue = $('#input_' + propertyName).val();
		if (newValue != '') {
			$.ajax({
				type: 'post',
				url: applicationName + '/admin/changeProperty',
				data: 'name=' + propertyName + '&value=' + newValue
			}).done(function (result) {
				$('#' + propertyName).html(result);
			});
		}
	}
</script>